<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JsUnit Assertion Tests</title>
<link rel="stylesheet" type="text/css" href="jsunit/css/jsUnitStyle.css">
<script language="JavaScript" type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
<script language="JavaScript" type="text/javascript" src="../content/lib/imkbizle_jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="../content/sourcesite.js"></script>
<script language="JavaScript" type="text/javascript" src="../content/site_adaptors/isteyatirim.js"></script>
<script language="JavaScript" type="text/javascript" src="../content/site_adaptors/akbank.js"></script>
<script language="JavaScript" type="text/javascript" src="../content/prefs.js"></script>
<script language="JavaScript" type="text/javascript">

// couldn't test some public functions (getStocks, setIntPref,
// getIntPref, load) because of unoverwritable private function
// calls. and couldn't test xul related user interface stuff.

function testget_source_site() {
	var tmpprefs = imkbizle_jquery.extend({}, prefs);
	var chosen_site_index = 0; //0: AKBANK, 1: ISTEYATIRIM
	prefs.getIntPref = function(key) {
		return chosen_site_index;
	};
	assertEquals("AKBANK", prefs.get_source_site().sitename);
	chosen_site_index = 1;
	assertEquals("ISTEYATIRIM", prefs.get_source_site().sitename);
	prefs = tmpprefs;
}

function testsave() {
	var flagSave = false;
	var tmpprefs = imkbizle_jquery.extend({}, prefs);
	prefs.settings = {
		hede: {
			save: function() {
				flagSave = true;
			}
		},
		hodo: {
			save: function() {
				flagSave = true;
			}
		}
	};
	prefs.save();
	assertTrue("problem in save function!", flagSave);
	prefs = tmpprefs;
}

</script>
</head>

<body>
<h1>Preferences Tests</h1>

<p>This page contains tests for the prefs operations for imkbizle.</p>
</body>
</html>
